package leetcode.string;

/**
 * @author mazouri
 * @create 2021-10-07 12:11
 */
public class _434_countSegments {
    public int countSegments(String s) {
        if (s == null || s.length() == 0) return 0;

        int count = 0;
        String[] s1 = s.split(" ");

        for (String s2 : s1) {
            if (!s2.equals(" ") && !s2.equals("")) count++;
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(new _434_countSegments().countSegments(", , , ,        a, eaefa"));
    }
}
